package org.jtorrent.torrent.type;

/**
 * Ryan Thomas
 * r.n.thomas@gmail.com
 *
 * @author ryan
 * @version $Revision$ $Author$ $Date$
 * @since Jun 21, 2009
 */
public class TorrentType<T> {
    private T payload;

    public TorrentType(final T payload) {
        this.payload = payload;
    }

    public T getPayload() {
        return payload;
    }

    @Override
    public String toString() {
        return payload.toString();
    }

    @Override
    public boolean equals(final Object o) {
        if(this == o) return true;
        if(o == null || getClass() != o.getClass()) return false;

        TorrentType that = (TorrentType) o;

        return !(payload != null ? !payload.equals(that.payload) : that.payload != null);
    }

    @Override
    public int hashCode() {
        return payload != null ? payload.hashCode() : 0;
    }
}
